#!/bin/sh
# SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later
# Copyright 2012, SIL International, All rights reserved.

TESTSDIR=$(dirname $0)
FONT=$1
TEXT=$2
shift 2
RTL=$1
if [ "z$RTL" = "z-r" ] ; then
    shift ;
else
    RTL= ;
fi
NLIM=$1
if [ "z$NLIM" = "z--nolimit" ] ; then
    shift ;
    NLIM="" ;
else
    NLIM="-t 10 --memory=200";
fi
${TESTSDIR}/fuzztest \
    -l fuzzfont-${FONT##**/}-${TEXT##**/}.log \
    -f ${TESTSDIR}/fonts/${FONT}.ttf \
    ${NLIM} -s 60 \
    --include=required,graphite \
    --exclude=fontdir,opentype,volt,advtypo,post,glyf \
    "$@" -- comparerenderer/comparerenderer \
        -q -s 12 -n ${RTL} \
        -f {} -t ${TESTSDIR}/texts/${TEXT}.txt
